#
# AI Events
#
#   written by 
#		Generalisimo
#
# 15020 - 15040

############################################################################################
# COMMONWEALTH PROTECTION FROM SEALION OPERATION
############################################################################################

#GERMANY INVADES BRITAIN#

event = {
	id = 15020
	random = no
	country = ENG
	
	trigger = {
      	ai = yes     
	war = { country = GER country = ENG }
  	NOT = {
		AND = {
			control = { province = 488 data = ENG } # Newcastle
			control = { province = 489 data = ENG } # Manchester
			control = { province = 490 data = ENG } # Sheffield
			control = { province = 491 data = ENG } # Cardiff
			control = { province = 497 data = ENG } # Birmingham
			control = { province = 498 data = ENG } # Coventry
			control = { province = 499 data = ENG } # London
			control = { province = 500 data = ENG } # Bristol
			control = { province = 501 data = ENG } # Plymouth
			control = { province = 502 data = ENG } # Southampton
			control = { province = 503 data = ENG } # Porstmouth
			}
		}

	}

	name = "AI_EVENT"
	desc = ""
	style = 0
	
	date = { day = 1 month = september year = 1936 }
	offset = 15 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
			command = { type = ai which = "core_uk_sealion.ai" }
			command = { type = trigger which = 15021 } # CAN
			command = { type = trigger which = 15022 } # SAF
			command = { type = trigger which = 15023 } # NZL
			command = { type = trigger which = 15024 } # AST
	}
}

# now for CAN, SAF, NZL, AST to help UK
event = {
	id = 15021
	random = no
	country = CAN

	# triggered by ENG 15020

	name = "AI_EVENT"
	desc = ""
	style = 0

	action_a = {
			command = { type = ai which = "core_uk_sealion.ai" }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
		}
}


event = {
	id = 15022
	random = no
	country = SAF

	# triggered by ENG 15020

	name = "AI_EVENT"
	desc = ""
	style = 0

	action_a = {
			command = { type = ai which = "core_uk_sealion.ai" }						
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
		}
}

event = {
	id = 15023
	random = no
	country = NZL

	# triggered by ENG 15020

	name = "AI_EVENT"
	desc = ""
	style = 0

	action_a = {
			command = { type = ai which = "core_uk_sealion.ai" }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
		}
}

event = {
	id = 15024
	random = no
	country = AST

	# triggered by ENG 15020

	name = "AI_EVENT"
	desc = ""
	style = 0

	action_a = {
			command = { type = ai which = "core_uk_sealion.ai" }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
	}
}

#if the UK expells the germans...
event = {
	id = 15025
	random = no
	country = ENG

	trigger = {
		ai = yes
		event = 15020 # Operation Sea Lion Defense

# national provinces: 482 483 484 485 486 487 488 489 490 491 497 498 499 500 501 502 503

			control = { province = 482 data = ENG } # 
			control = { province = 483 data = ENG } # 
			control = { province = 484 data = ENG } # 
			control = { province = 485 data = ENG } # 
			control = { province = 486 data = ENG } # 
			control = { province = 487 data = ENG } # 
			control = { province = 488 data = ENG } # Newcastle
			control = { province = 489 data = ENG } # Manchester
			control = { province = 490 data = ENG } # Sheffield
			control = { province = 491 data = ENG } # Cardiff
			control = { province = 497 data = ENG } # Birmingham
			control = { province = 498 data = ENG } # Coventry
			control = { province = 499 data = ENG } # London
			control = { province = 500 data = ENG } # Bristol
			control = { province = 501 data = ENG } # Plymouth
			control = { province = 502 data = ENG } # Southampton
			control = { province = 503 data = ENG } # Porstmouth
	}
	
	name ="AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "core_uk.ai" }
		}
}

############################################################################################
# COMMONWEALTH AT WAR
############################################################################################
event = {
	id = 15026
	random = no
	country = CAN

	trigger = {
		ai = yes
		atwar = yes
	}

	name = "AI_EVENT"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "core_Canada_War.ai" }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
	}
}

event = {
	id = 15027
	random = no
	country = NZL

	trigger = {
		ai = yes
		atwar = yes
	}

	name = "AI_EVENT"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "core_New_Zealand_War.ai" }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
	}
}

event = {
	id = 15028
	random = no
	country = EGY

	trigger = {
		ai = yes
		atwar = yes
		alliance = { country = EGY  country = ENG }
	}

	name = "AI_EVENT"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "core_Egypt_War_allies.ai" }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
	}
}

event = {
	id = 15029
	random = no
	country = AST
	trigger = {
		ai = yes
		atwar = yes
	}

	name = "AI_EVENT"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "core_Australia_War.ai" }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
	}
}

event = {
	id = 15030
	random = no
	country = SAF
	trigger = {
		ai = yes
		atwar = yes
	}

	name = "AI_EVENT"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "core_South_Africa_War.ai" }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
			command = { type = add_division which = transports }
	}
}

############################################################################################
# OUT of EUROPE AI for BEL, HOL & FRA
############################################################################################

event = {
	id = 15031
	random = no
	country = BEL
	trigger = {
		ai = yes
		NOT = {
			OR = {
				control = { province = 548 data = BEL } # Antwerpen
				control = { province = 552 data = BEL } # Bruxelles
				control = { province = 557 data = BEL } # Arlon		
				}
			}
		}

	name = "AI_EVENT"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "core_out_of_europe.ai" }
		command = { type = add_division which = militia }
		command = { type = add_division which = militia }
		command = { type = add_division which = militia }
		}
}

event = {
	id = 15032
	random = no
	country = HOL
	trigger = {
		ai = yes
		NOT = {
			OR = {
				control = { province = 561 data = HOL } # Arnhem
				control = { province = 550 data = HOL } # Amsterdam
				control = { province = 551 data = HOL } # Eindhoven
				control = { province = 590 data = HOL } # Groningen
				}
			}
		}

	name = "AI_EVENT"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "core_out_of_europe.ai" }
		command = { type = add_division which = militia }
		command = { type = add_division which = militia }
		command = { type = add_division which = militia }
		}
}

event = {
	id = 15033
	random = no
	country = FRA
	trigger = {
		ai = yes
		exists = VIC # Vichy exists
	}

	name = "AI_EVENT"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "core_out_of_europe.ai" }
		command = { type = add_division which = militia when = 312 }
		command = { type = add_division which = militia when = 312 }
		command = { type = add_division which = militia when = 312 }
		}
}

###########################################################################
#
#USA at war
###########################################################################

#THE TIDE TURNS - US GOES OFFENSIVE#

event = {
	id = 15034
	random = no
	country = USA

	trigger = {
		ai = yes
		atwar = yes
		}
	
	name ="AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "core_USA_War.ai" }
		}
}

###########################################################################
#
#Brazil joins the allies
###########################################################################

event = {
	id = 15035
	random = no
	country = BRA

	trigger = {
		ai = yes
		atwar = yes
		alliance = { country = BRA  country = ENG }
		}
	
	name ="AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "core_Brazil_War_allies.ai" }
	}
}

###########################################################################
#
#USSR at war against GER (+USA +ENG )
###########################################################################

#THE TIDE TURNS - SOV GOES OFFENSIVE#

event = {
	id = 15036
	random = no
	country = SOV

	trigger = {
		ai = yes
		war = { country = GER country = USA }
		war = { country = GER country = ENG }
		war = { country = GER country = SOV }
		event = 10012 # USSR_defense.ai
	}
	
	name ="AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 15
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "core_USSR_rebound.ai" }
	}
}

############################################################################################
# ETHIOPIA AXIS
############################################################################################

#ETH AXIS#

event = {
	id = 15037
	random = no
	country = ETH
	
	trigger = {
	      	ai = yes     
		OR = {
			puppet = { country = ETH country = ITA } 
			alliance = { country = ETH country = GER }
			}
		}

	name = "AI_EVENT"
	desc = ""
	style = 0
	
	date = { day = 1 month = september year = 1936 }
	offset = 15 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
			command = { type = ai which = "core_Ethiopia_Axis.ai" }
		}
}

###########################################################################
#USSR AI 1940 after the Winter War 
###########################################################################

event = {
	id = 15038
	random = no
	country = SOV

	trigger = {
		ai = yes
		}
	
	name ="AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = march year = 1940 }
	offset = 5 
	deathdate = { day = 29 month = december year = 1940 }

	action_a = {
		command = { type = ai which = "core_ussr1940.ai" }
	}
}

# USA strategic choice - Iberia

event = {
	id = 15039
	random = no
	country = USA
	
	trigger = {
	      	ai = yes     
		war = { country = USA country = POR }
		war = { country = USA country = SPA }
	}

	name = "AI_EVENT"
	desc = ""
	style = 0
	
	date = { day = 1 month = september year = 1940 }
	offset = 15
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "West"
		command = { type = ai which = "core_usa_West_Iberia.ai" }
	}
}


# USA strategic choice - back to Italy and France

event = {
	id = 15040
	random = no
	country = USA
	
	trigger = {

	      	ai = yes

		event = 15039    # Spain and Portugal were targets

		war = { country = USA country = GER }

		control = { province = 451 data = USA } # Portugal and Spain
		control = { province = 1020 data = USA }
		control = { province = 1019 data = USA }
		control = { province = 975 data = USA }

			NOT = {
				control = { province = 956 data = SPA } # Spain
				control = { province = 988 data = SPA }
				control = { province = 996 data = SPA }
				control = { province = 981 data = SPA }
				control = { province = 990 data = SPA }
			}
	}

	name = "AI_EVENT"
	desc = ""
	style = 0
	
	date = { day = 1 month = september year = 1940 }
	offset = 15
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = ""
		command = { type = ai which = "core_usa_War.ai" }

	}
}

###########################################################################
#
#USSR goes 'Suvorov style'
###########################################################################

#THE TIDE TURNS - SOV GOES 'Suvorov style' OFFENSIVE :)#

event = {
	id = 15041
	random = no
	country = SOV

	trigger = {
		ai = yes
	}
	
	name ="AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1942 }
	offset = 15
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "core_USSR_rebound.ai" }
	}
}


###########################################################################
#
# USSR takes Berlin (by Copper Nicus)
# change of AI, Great Patriotic War effect wears off, post-war AI is on
#
###########################################################################



event = {
	id = 15042
	random = no
	country = SOV

	trigger = {
		ai = yes
		event = 222084 # Great Patriotic War happened
		control = { province = 602 data = SOV } # Berlin
	}
	
	name ="AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1942 }
	offset = 15
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = gain_tech which = 11514 } # End of GPW
		command = { type = ai which = "core_USSR_post.ai" }
	}
}

###########################################################################
# SPA wins the civil war
###########################################################################
event = {
	id = 15043
	random = no
	country = SPA
	
	trigger = {
		ai = yes 
	      	NOT = {
			exists = SPR
			}
	}

	name = "AI_EVENT"
	desc = ""
	style = 0
	
	date = { day = 1 month = october year = 1936 }
	offset = 1
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "West"
		command = { type = ai which = "core_spain.ai" }
	}
}
###########################################################################
# SPR wins the civil war
###########################################################################
event = {
	id = 15044
	random = no
	country = SPR
	
	trigger = {
		ai = yes 
	      	NOT = {
			exists = SPA
			}
	}

	name = "AI_EVENT"
	desc = ""
	style = 0
	
	date = { day = 1 month = october year = 1936 }
	offset = 1
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
		name = "West"
		command = { type = ai which = "core_spain.ai" }
	}
}


#######################################################################
#   USA switches to the pre-war AI
# War in Europe triggers development of land forces

event = {
	id = 15045
	random = no
	country = USA

	trigger = {
		ai = yes
		war = { country = GER country = ENG }		
	}
	
	name ="AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1938 }
	offset = 15
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "core_usa.ai" }
	}
}

#########################################################################

# Italy switches to Axis AI

event = {
	id = 15046
	random = no
	country = ITA

	trigger = {
		ai = yes
		alliance = { country = GER country = ITA }		
	}
	
	name ="AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1938 }
	offset = 15
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "core_Italy_axis.ai" }
	}
}

